import { checkOperate } from '../../services';
import { showPressModal } from '../containers/MyTaskActionModal';

export const showReScoreModal = async (record, ReScoreModalRef, setActionLoading, form) => {
    // 先判断上次发起的重评是否在审核中，如果在审核中则弹出催办
    setActionLoading(true);
    const res = await checkOperate(record.id);
    const { code, data } = res;
    if (code === 10000) {
        const { enable, inAuditFlag, auditEmployeeName, operateType } = data;
        if (enable) {
            ReScoreModalRef.current.showReScoreModal(record);
        }
        if (inAuditFlag) {
            showPressModal({
                form,
                taskId: record.id,
                type: '审核',
                operateType,
                employeeName: auditEmployeeName
            });
            setActionLoading(false);
        }
    }
};
